Skip to content

fix(export): gate tagged_nodes/coverage stats on embed_hierarchy_attributes#281

Closed
xieofxie wants to merge 3 commits into
mainfrom
hualxie/fix-bug-D
Closed

fix(export): gate tagged_nodes/coverage stats on embed_hierarchy_attributes#281
xieofxie wants to merge 3 commits into
mainfrom
hualxie/fix-bug-D

Conversation

@xieofxie

@xieofxie xieofxie commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add _update_tag_stats(total_nodes) helper on HTPExporter that centralises the embed-aware calculation: tagged_nodes and coverage_percentage report 0 when embed_hierarchy_attributes=False (i.e. wmk export --no-hierarchy).
  • Replace the two duplicated inline stat-calculation blocks in export() and _apply_hierarchy_tags() with calls to _update_tag_stats().

Test plan

  • TestHTPExporterTaggedNodesStats::test_tagged_nodes_zero_when_hierarchy_disabled
  • TestHTPExporterTaggedNodesStats::test_coverage_zero_when_hierarchy_disabled
  • TestHTPExporterTaggedNodesStats::test_tagged_nodes_nonzero_when_hierarchy_enabled (control)

Extracted from #209 (Bug D only).

🤖 Generated with Claude Code

…attributes

Add _update_tag_stats() to centralise the embed-aware calculation, so
tagged_nodes and coverage_percentage report 0 when hierarchy tagging is
disabled via --no-hierarchy.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@xieofxie xieofxie requested a review from a team as a code owner April 9, 2026 08:11
timenick
timenick previously approved these changes Apr 10, 2026
@xieofxie xieofxie changed the title fix(export): gate tagged_nodes/coverage stats on embed_hierarchy_attributes (Bug D) fix(export): gate tagged_nodes/coverage stats on embed_hierarchy_attributes Apr 13, 2026
…PORT_STATS

- Move empty_tags calculation into _update_tag_stats so it is consistently
  zeroed when embed_hierarchy_attributes=False, matching tagged_nodes and
  coverage_percentage.
- Remove now-redundant standalone empty_tags blocks from export() and
  _apply_hierarchy_tags().
- Add per-field comments to DEFAULT_EXPORT_STATS explaining each stat.
- Merge the two redundant disabled-hierarchy tests into one; drop "Bug D:"
  from class docstring.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@tezheng tezheng closed this Apr 13, 2026
@tezheng tezheng deleted the hualxie/fix-bug-D branch April 13, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants